package com.config;

import com.entity.Car;
import com.entity.Person;
import org.springframework.context.annotation.*;

@Configuration
@ComponentScan(basePackages = "com")
public class MySpringConfiguration {

    @Bean("car1")
    public Car initBenzCar(){
        return new Car("BENZ","white",300000);
    }

    @Bean("car2")
    public Car initBmwCar(){
        return new Car("BMW","red",500000);
    }

    @Bean("car3")
    public Car initToyotaCar(){
        return new Car("TOYOTA","black",100000);
    }

    @Bean("p1")
    @Lazy(true)
    public Person initPerson1(){
        return new Person("张三","男","2001-10-01","河南省南阳市",new Car("BENZ","white",300000) );
    }

    @Bean("p2")
    @Lazy(true)
    @Scope("prototype")
    public Person initPerson2(){
        return new Person("李四","女","2002-10-01","河南省郑州市",new Car("BMW","red",500000) );
    }

    @Bean("p3")
    @Lazy(true)
    @Scope("prototype")
    public Person initPerson3(){
        return new Person("宋小宝","男","2002-10-01","辽宁省铁岭市");
    }
}
